package com.fable.sp.core.domain;

import java.io.Serializable;

/**
 * .
 *
 * @author stormning on 16/8/3.
 */
public class Style implements Serializable {
    private Background background;

    private Borders border;

    private Font font;

    private Box padding;

    private Box margin;

    private Align textAlign;

    private String display = "inherit";

    public Background getBackground() {
        return background;
    }

    public void setBackground(Background background) {
        this.background = background;
    }

    public Borders getBorder() {
        return border;
    }

    public void setBorder(Borders border) {
        this.border = border;
    }

    public Font getFont() {
        return font;
    }

    public void setFont(Font font) {
        this.font = font;
    }

    public Box getPadding() {
        return padding;
    }

    public void setPadding(Box padding) {
        this.padding = padding;
    }

    public Box getMargin() {
        return margin;
    }

    public void setMargin(Box margin) {
        this.margin = margin;
    }

    public String getDisplay() {
        return display;
    }

    public void setDisplay(String display) {
        this.display = display;
    }

    public Align getTextAlign() {
        return textAlign;
    }

    public void setTextAlign(Align textAlign) {
        this.textAlign = textAlign;
    }

    @Override
    public String toString() {
        StringBuilder style = new StringBuilder();
        if (display != null) {
            style.append("display:").append(display).append(";");
        }
        if (background != null) {
            style.append(background.toString());
        }
        if (border != null) {
            style.append(border.toString());
        }
        if (font != null) {
            style.append(font.toString());
        }
        if (padding != null) {
            style.append(padding.toString("padding"));
        }
        if (margin != null) {
            style.append(margin.toString("margin"));
        }
        if (textAlign != null) {
            style.append("text-align:").append(textAlign.toString()).append(";");
        }
        return style.toString();
    }
}
